<template>
  <div>
    <h2>Child</h2>
    <p>父组件传来的name: {{ name }}</p>
    <p>父组件传来的age: {{ age }}</p>
    <button @click="handleClick">计数：{{count}}</button>
  </div>
</template>

<script>

import {ref} from "vue";

export default {
  props: {
    name: {
      type: String,
    },
    age: {
      type: String,
    },
  },
  setup(props,{emit}) {
    let count = ref(0);

    function handleClick() {
        emit("count",++ count.value);
    }

    return {handleClick,count}
  },
};
</script>

<style>
</style>